function LoadModel(viewer) {
    var position1 =Cesium.Cartesian3.fromDegrees(120.4325403235,36.31470,0)
    var position2 =Cesium.Cartesian3.fromDegrees(120.42899,36.31460,0)

var orientation1 = Cesium.Transforms.headingPitchRollQuaternion(
  position1,
  new Cesium.HeadingPitchRoll(-0.19, 0.0, 0.0)
);
var orientation2 = Cesium.Transforms.headingPitchRollQuaternion(
  position2,
  new Cesium.HeadingPitchRoll(1.3, 0.0, 0.0)
);
var f3 =viewer.entities.add({
    position:position1,
    orientation:orientation1,
    model:{
        uri:'../models/f3.gltf',
        scale:0.4
    },
    properties:{
        name:"西安电子科技大学青岛研究院",
    }
})
var doctor_main = viewer.entities.add({
    position:position2,
    orientation:orientation2,
    model:{
        uri:'../models/doctor_building.gltf',
    },
    properties:{
        name:"青岛博士后创新创业园"
    }
});
var tileset =new Cesium.Cesium3DTileset({
    url:"../models/around/tileset.json"
})

var doctor_building =
    viewer.scene.primitives.add(tileset);
    viewer.zoomTo(tileset)
viewer.scene.debugShowFramesPerSecond = true;
    changeColor(tileset, 'rgb(255,255,255)');
    viewer.dataSources.add(
        Cesium.GeoJsonDataSource.load(
          "models/road.json",
          {
            stroke: Cesium.Color.DIMGRAY,
            fill: Cesium.Color.DIMGRAY.withAlpha(1),
            strokeWidth: 3,
          }
        )
      );
    //       viewer.dataSources.add(
    //     Cesium.GeoJsonDataSource.load(
    //       "models/small_roads.json",
    //       {
    //         stroke: Cesium.Color.GRAY,
    //         fill: Cesium.Color.GRAY.withAlpha(1),
    //         strokeWidth: 3,
    //       }
    //     )
    //   )
}

//更改primitives位置
function changePosition(model, lon, lat, height, roll, scale) {
    model.readyPromise.then(function (argument) {
        var position = Cesium.Cartesian3.fromDegrees(lon, lat, height);
        var mat = Cesium.Transforms.eastNorthUpToFixedFrame(position);
        var rotationZ = Cesium.Matrix4.fromRotationTranslation(Cesium.Matrix3.fromRotationZ(Cesium.Math.toRadians(
            roll)));
        Cesium.Matrix4.multiply(mat, rotationZ, mat);
        if (scale != undefined) {
            var modelScale = Cesium.Matrix4.fromUniformScale(scale);
            Cesium.Matrix4.multiply(mat, modelScale, mat);
        }
        model._root.transform = mat;
    })
}

//更改颜色
function changeColor(model, color) {
    model.style = new Cesium.Cesium3DTileStyle({
        color: color,
        meta: {
            description: "'Building ${BIN} has height ${Height}.'",
        },
    });
}

export {LoadModel};